//
//  ExcellentTableViewCell.m
//  Courses
//
//  Created by YiXuePxh on 15/5/19.
//  Copyright (c) 2015年 boyibang. All rights reserved.
//

#import "ExcellentTableViewCell.h"
#import "UIImageView+WebCache.h"
#define ratio 35
@implementation ExcellentTableViewCell{
    UIImageView*    _showImage;
    UILabel*        _nameLabel;
    UILabel*        _teacherLabel;
    UILabel*        _countLabel;
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (!self) {
        return self;
    }
    //初始化相关属性
    self.backgroundColor = nil;
    self.clipsToBounds = YES;
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    _showImage = [[UIImageView alloc]initWithFrame:AutoRectMake(24 , 12, 89 , 57, WTFAutoLayoutTypePic)];
    _showImage.contentMode = UIViewContentModeScaleAspectFit;
    [self.contentView addSubview:_showImage];
    
    _nameLabel = [[UILabel alloc] initWithFrame:AutoRectMake(124, 14, 200 , 16, WTFAutoLayoutTypePic)];
    _nameLabel.font = [UIFont fontWithName:nil size:15];
    [self.contentView addSubview:_nameLabel];
    
    _teacherLabel = [[UILabel alloc] initWithFrame:AutoRectMake(124, 38, 200, 15, WTFAutoLayoutTypePic)];
    _teacherLabel.font = [UIFont fontWithName:nil size:11];
    [self.contentView addSubview:_teacherLabel];
    
    _countLabel = [[UILabel alloc]initWithFrame:AutoRectMake(124, 54, 200, 15, WTFAutoLayoutTypePic)];
    [self.contentView addSubview:_countLabel];
    _countLabel.font = [UIFont fontWithName:nil size:11];
    return self;
}
-(void)setExcellent:(ExcellentClass *)excellent{
    [_showImage setImage:[UIImage imageNamed:excellent.classPicUrl]];
    _nameLabel.text = excellent.className;
    _teacherLabel.text = [NSString stringWithFormat:@"主讲人：%@",excellent.teacher];
    _countLabel.text = [NSString stringWithFormat:@"集数：%@",excellent.classCount];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
